package com.forenow.demo.AnimalTest;

public class Test {
    public static void main(String[] args) {
            Animal cat=new Cat("加菲猫",4);  //父类的引用指向子类的对象
            String catname=cat.getName();
            int catlegNum=cat.getLegNum();
            System.out.println("动物名字\t\t腿的条数\t\t叫声");
            System.out.print(catname+"\t\t"+cat.getLegNum()+"条腿\t\t");
            cat.shuot();
            Animal duck=new Duck("唐老鸭",2);
            String ducknName=duck.getName();
            int ducklegNum=duck.getLegNum();
            System.out.print(ducknName+"\t\t"+duck.getLegNum()+"条腿\t\t");
            duck.shuot();
    }
}
